SUMMARY = "realtek 8188eu usb wifi modules"
DESCRIPTION = "${SUMMARY}"
LICENSE = "CLOSED"
LIC_FILES_CHKSUM = " "

inherit module

SRCBRANCH = "master"
RTL8188EU_SRC ?= "git://gitee.com/githubmap/rtl8188eu.git;protocol=https"
SRC_URI = "${RTL8188EU_SRC};branch=${SRCBRANCH}"
SRCREV = "${AUTOREV}"
S = "${WORKDIR}/git"

FILES:${PN} += "${base_libdir}/firmware/*"

EXTRA_OEMAKE = "ARCH=${ARCH} CROSS_COMPILE=${TARGET_PREFIX} KSRC=${STAGING_KERNEL_BUILDDIR} -C ${STAGING_KERNEL_BUILDDIR} M=${S}"
# 重写 do_compile 函数
do_compile() {
    oe_runmake ${EXTRA_OEMAKE} modules
}

# 重写 do_install 函数
do_install() {
    install -d ${D}${base_libdir}/modules/${KERNEL_VERSION}
    install -m 644 ${S}/8188eu.ko ${D}${base_libdir}/modules/${KERNEL_VERSION}

    install -d ${D}/lib/firmware
    install -m 644 ${S}/rtl8188eufw.bin ${D}/lib/firmware
}

RPROVIDES:${PN} += "kernel-module-rtl8188eu"